Skip to content

Align behaviour for tests based on async generators with pytest #643

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

seifertm
Copy link
Contributor

Test items based on asynchronous generators always exit with xfail status and emit a warning during the collection phase. This behavior is consistent with synchronous yield tests in pytest.

This changeset also fixes a regression introduced in main that caused these kind of tests to fail rather than skip or xfail.

Closes #642

…arked with "asyncio" into a separate test module.

The "test_simple" module is named too general. Thus, it serves as a magnet for all kinds of tests that aren't connected to each other. This is one step to break up the "test_simple" module into more coherent test modules.

Signed-off-by: Michael Seifert <[email protected]>
…nstead of the older "testdir" fixture.

Signed-off-by: Michael Seifert <[email protected]>
…xfail* status and emit a warning during the collection phase. This behavior is consistent with synchronous yield tests.

Signed-off-by: Michael Seifert <[email protected]>
Tests use command-line arguments to set the asyncio mode and warnings filter, instead of a .ini file. This reduces the number of lines in the test module significantly.

Signed-off-by: Michael Seifert <[email protected]>
@codecov-commenter
Copy link

codecov-commenter commented Oct 23, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.48%. Comparing base (106fa54) to head (861a8ae).
Report is 428 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #643      +/-   ##
==========================================
+ Coverage   93.28%   93.48%   +0.20%     
==========================================
  Files           2        2              
  Lines         387      399      +12     
  Branches       83       85       +2     
==========================================
+ Hits          361      373      +12     
  Misses         15       15              
  Partials       11       11              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@seifertm seifertm added this pull request to the merge queue Oct 24, 2023
Merged via the queue into pytest-dev:main with commit b6b2c7f Oct 24, 2023
@seifertm seifertm deleted the fix/confusing-warning-for-yield-tests branch October 24, 2023 06:21
@seifertm seifertm restored the fix/confusing-warning-for-yield-tests branch October 24, 2023 10:46
@seifertm seifertm deleted the fix/confusing-warning-for-yield-tests branch April 29, 2024 12:47
@seifertm seifertm restored the fix/confusing-warning-for-yield-tests branch April 29, 2024 12:55
@seifertm seifertm deleted the fix/confusing-warning-for-yield-tests branch April 29, 2024 13:18
@seifertm seifertm restored the fix/confusing-warning-for-yield-tests branch May 19, 2024 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistent behavior for sync and async generator functions
2 participants